<?php
$this->breadcrumbs=array(
	'Apps'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'List Apps', 'url'=>array('index')),
	array('label'=>'Create Apps', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('apps-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>APP 管理</h1>

<?php echo CHtml::link('查找','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
	'categories' => $categories,
	'appsType' => $appsType,
	'appsPlatType' => $appsPlatType,
	'cnAppsStatus' => $cnAppsStatus,
)); ?>
</div><!-- search-form -->
<?php 
if($category_code != null)
	echo CHtml::link('添加',array('create' , 'category_code' => $category_code)); 
?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'apps-grid',
	'dataProvider'=>$model->search(),
	'columns'=>array(
		'app_id',
array(
		'name'=>'admin_id',
		'type'=>'raw',
		'value'=>array($this, 'showAdmin')
),
		'category_code',
		'app_type',
		'app_name',
		'download_count',
		/*
		'icon_src',
		'img',
		'last_update',
		'install_url',
		'platform_type',
		'original_price',
		'price',
		'size',
		'score',
		'corporation',
		'summary',
		'version',
		'ctime',
		'mtime',
		'status',
		*/
		array(
			'class'=>'CButtonColumn',
			'template'=>'{comment} {view} {update} {delete}',
			'buttons'=>array(
				'comment' => array(
					'label'=>'评论',
					//'imageUrl'=>Yii::app()->request->baseUrl.'/images/icons/coins.png',
					'url'=>'Yii::app()->createUrl("appsComments/index", array("app_id"=>$data->app_id, ))',
				),
			),
			'htmlOptions' => array(
					'style'=>'width:100px',
			),
		),
	),
)); ?>
